using UnityEngine;

public class HeliSounds : MonoBehaviour
{
	private float _heliEngineForceValue;

	private GameObject _heli;

	private HeliController contrHelic;

	private AudioSource audioHelic;

	private void Awake()
	{
		_heli = base.transform.parent.gameObject;
	}

	private void Start()
	{
	}

	private void Update()
	{
		if (contrHelic == null)
		{
			contrHelic = _heli.GetComponent<HeliController>();
		}
		if (audioHelic == null)
		{
			audioHelic = base.gameObject.GetComponent<AudioSource>();
		}
		if (contrHelic.enabled)
		{
			_heliEngineForceValue = contrHelic.GetEngineForceValue();
			if (_heliEngineForceValue < 0.4f)
			{
				audioHelic.volume = _heliEngineForceValue;
			}
			else
			{
				audioHelic.volume = _heliEngineForceValue;
			}
			audioHelic.pitch = 0.1f + _heliEngineForceValue;
		}
	}
}
